<template>
  <view>
    <!-- 头部-->
    <view class="">
      <my-navbar :widthdata="titlewid">
        <template #icons>
          <uni-icons @click="back" color="white" type="left" size="20"> </uni-icons>
        </template>

        <template #title>
          <span id="myView" ref="myView" style="color: white;">下单成功</span>
        </template>
      </my-navbar>
    </view>


    <!-- 中间部分-->
    <view class="">
      <view class="" style="margin-top: 30%;text-align: center;">
        <image style="width: 70px;height: 80px;" src="../../static/success.png" mode=""></image>
      </view>
      <view class="" style="font-weight: bold;margin-top: 10px;text-align: center;">
        下单成功
      </view>

      <view class="" style="text-align: center;justify-content: center;margin-top: 20px;color: #ccc;font-size: 14px;">
        预计
        <text style="color: orange;font-size: 14px;">{{time}}</text>
        送达
      </view>

      <view class="" style="margin-top: 20px;color: #ccc;text-align: center;font-size: 14px;">
        后台正在加紧制作中，请耐心等待~
      </view>

      <view class="" style="display: flex;margin-top: 20px;">
        <button @click="back" style="width: 30%;">返回首页</button>
        <button style="background-color: orange;width: 30%;">查看订单</button>
      </view>

    </view>


  </view>
</template>

<script>
  export default {
    data() {
      return {
        wh: 0,

        titlewid: 0,
        time: ''
      };
    },
    onLoad() {

      // 获取当前时间
      const now = new Date();
      // 获取小时（24小时制）
      //  this.speed = now.getHours().toString().padStart(2, '0') + ':' + now.getMinutes().toString().padStart(2, '0')
      now.setMinutes(now.getMinutes() + 30);
      const hours = now.getHours().toString().padStart(2, '0'); // 获取小时
      const minutes = now.getMinutes().toString().padStart(2, '0'); // 获取分钟
      this.time = hours + ':' + minutes

    },
    mounted() {
      let info = uni.createSelectorQuery().in(this).select('#myView');
      info.boundingClientRect(data => {
        //  console.log(data, "data")
        this.titlewid = data.width
      }).exec()
    },
    methods: {
      back() {
        uni.navigateTo({
          url: '/pages/home/home'
        })
      }
    }
  }
</script>

<style lang="scss">

</style>